/*
 * @Description:
 * @Author: zheng yiliang
 * @Date: 2021-03-11 21:16:43
 * @LastEditTime: 2021-04-08 20:22:31
 * @LastEditors: zheng yiliang
 */
import request from '@/utils/request'

// 登录
export function login (data) {
  return request({
    url: '/users/login',
    method: 'post',
    data
  })
}

// 退出
export function logout () {
  return request({
    url: '/users/logout',
    method: 'post'
  })
}

// 获取用户列表
export function getAllUser (queryInfo) {
  return request({
    url: '/users/list',
    method: 'get',
    params: queryInfo
  })
}

// 改变用户状态，false为不可登录
export function stateChange (data) {
  return request({
    url: '/users/setState',
    method: 'put',
    data
  })
}

// 添加用户
export function addUser (data) {
  return request({
    url: '/users/add',
    method: 'post',
    data
  })
}

// 获取用户信息
export function getUser (detail) {
  return request({
    url: `/users/detail`,
    method: 'get',
    params: detail
  })
}

// 修改用户信息
export function editUser (users) {
  return request({
    url: `/users/edit`,
    method: 'put',
    data: users
  })
}

// 删除用户
export function delUser (id) {
  return request({
    url: `/users/delete`,
    method: 'delete',
    data: id
  })
}

// 设置用户角色信息
export function updateUserRoles (data) {
  return request({
    url: '/users/roleUpdate',
    method: 'put',
    data
  })
}
